from datetime import datetime
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()

class CommentThumbs(db.Model):
    __tablename__ = 'comment_thumbs'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='id')
    c_id = db.Column(db.Integer, nullable=False, comment='评论id')
    uid = db.Column(db.Integer, nullable=False, comment='用户id')
    create_time = db.Column(db.DateTime, default=datetime.utcnow, comment='创建时间')

    def to_dict(self):
        return {
            'id': self.id,
            'cid': self.c_id,
            'uid': self.uid,
            'createTime': self.create_time.isoformat() if self.create_time else None
        }
